lib: Ensure we use _GNU_SOURCE in enum templates
authorColin Walters <walters@verbum.org>
Tue, 6 Dec 2016 16:30:19 +0000 (11:30 -0500)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 7 Dec 2016 23:00:58 +0000 (23:00 +0000)
Due to the way glib-mkenums runs the preprocessor itself, it
doesn't pick up the `AC_USE_SYSTEM_EXTENSIONS()` that we have in
`configure.ac`.

This blew up in an obscure way when I later wanted to `#include
"libglnx.h"` in one of the headers, since it needs the `basename()`
from `string.h` which is only available with `_GNU_SOURCE`.

Closes: #616
Approved by: jlebon

src/libostree/ostree-enumtypes.c.template

index ab1b2aec7586a0846aba8ef23d88670af04f9092..52da7de19ff78371ec80ec77348da43e7ec3145d 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <string.h>
+
 /*** END file-header ***/
 
 /*** BEGIN file-production ***/
+
 /* enumerations from "@filename@" */
 #include "@filename@"